package com.exoweb.games.hexagone
{
    import flash.display.*;
    import flash.events.*;

    import com.exoweb.games.hexagone.business.HexService;
    import com.exoweb.games.hexagone.model.HexModelLocator;
    import com.exoweb.games.hexagone.view.*;

    [SWF(width="640", height="480", backgroundColor="#000000")]
    public class Hexagone extends Sprite
    {
        private var service:HexService;
        private var model:HexModelLocator;
        private var coverPage:CoverPage;
        private var introduction:Introduction;
        private var mainGame:MainGame;

        public function Hexagone()
        {
            //service = HexService.getInstance();
            model = HexModelLocator.getInstance();

            coverPage = new CoverPage();
            coverPage.addEventListener(MouseEvent.MOUSE_DOWN, gotoIntroduction);
            addChild(coverPage);
        }

        private function gotoIntroduction(e:Event):void
        {
            coverPage.removeEventListener(MouseEvent.MOUSE_DOWN, gotoIntroduction);
            removeChild(coverPage);

            introduction = new Introduction();
            introduction.addEventListener(MouseEvent.MOUSE_DOWN, gotoMainGame);
            addChild(introduction);
        }

        private function gotoMainGame(e:Event):void
        {
            introduction.removeEventListener(MouseEvent.MOUSE_DOWN, gotoMainGame);
            removeChild(introduction);

            mainGame = new MainGame();
            addChild(mainGame);
        }
    }
}
